/***************************************************************************

-------------------
    begin                : 
    copyright            : kuzkok
    email                : kuzkok at gmail.com

***************************************************************************
*                                                                         *
*   This program is free software; you can redistribute it and/or modify  *
*   it under the terms of the GNU General Public License as published by  *
*   the Free Software Foundation; either version 2 of the License, or     *
*   (at your option) any later version.                                   *
*   
*   Данная программа является свободным программным обеспечением;         *
*   Вы можете распространять ее и/или модифицировать в соответствии с     *
*   GNU General Public License опубликованной Фондом свободного           *
*   программного обеспечения; используемая версия лицензии - 2 или        *
*   (по вашему выбору) любая более поздняя                                *
***************************************************************************/

#include "onlinepolylineforofflinefeature.h"

OnlinePolylineForOfflineFeature::OnlinePolylineForOfflineFeature(QString theTableName) :
        OnlinePolyline(theTableName)
{
}

OnlinePolylineForOfflineFeature::OnlinePolylineForOfflineFeature(QUuid theEventID, QString theTableName) :
        OnlinePolyline(theEventID, theTableName)
{
    if(mObjectState)
    {
        mBeginOffsetAngle = mSelectQuery->value(mSelectQuery->record().indexOf("beginoffsetangle")).toDouble();
        mBeginOffsetDistance = mSelectQuery->value(mSelectQuery->record().indexOf("beginoffsetdistance")).toDouble();
        mEndOffsetAngle = mSelectQuery->value(mSelectQuery->record().indexOf("endoffsetangle")).toDouble();
        mEndOffsetDistance = mSelectQuery->value(mSelectQuery->record().indexOf("endoffsetdistance")).toDouble();
        mStationLocated = mSelectQuery->value(mSelectQuery->record().indexOf("stationlocated")).toString();
    }
}

void OnlinePolylineForOfflineFeature::buildInsertStatement()
{
    OnlinePolyline::buildInsertStatement();
    mInsertStatementFields += ", stationlocated";
    mInsertStatementValues += ", :stationlocated";
}

void OnlinePolylineForOfflineFeature::buildUpdateStatement()
{
    OnlinePolyline::buildUpdateStatement();
    mUpdateStatement += ", stationlocated = :stationlocated";
}

void OnlinePolylineForOfflineFeature::bindQueryValues(QSqlQuery &query)
{
    OnlinePolyline::bindQueryValues(query);
    query.bindValue(":stationlocated", mStationLocated);
}
